
package SubsitemaAgenda;

import javax.swing.ImageIcon;

public class DialogoPagarCita extends javax.swing.JDialog {

    private service.Cita cita;
    private String idPrograma;
    private boolean conPrograma;
    
    public DialogoPagarCita(java.awt.Frame parent, boolean modal, service.Cita cita, String idPrograma, boolean conPrograma) {
        initComponents();
        setIconImage(new ImageIcon(getClass().getResource("/GUI/Img/logo2.png")).getImage());
        this.cita = cita;
        this.idPrograma = idPrograma;
        this.conPrograma = conPrograma;
    }
    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jComboBox1 = new javax.swing.JComboBox();
        botonPagar = new javax.swing.JButton();
        botonCancelar = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Pagar Cita");
        setModal(true);

        jLabel1.setText("Pagar con:");

        jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Bono", "Cheque", "Efectivo" }));

        botonPagar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/GUI/Img/Aceptar.png"))); // NOI18N
        botonPagar.setText("Aceptar");
        botonPagar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botonPagarActionPerformed(evt);
            }
        });

        botonCancelar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/GUI/Img/Cancelar.png"))); // NOI18N
        botonCancelar.setText("Cancelar");
        botonCancelar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botonCancelarActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(botonPagar, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(botonCancelar))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(jLabel1)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, 199, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(32, 32, 32)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 29, Short.MAX_VALUE)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(botonCancelar)
                    .addComponent(botonPagar))
                .addContainerGap())
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addGap(0, 0, Short.MAX_VALUE)
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void botonPagarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonPagarActionPerformed
        this.dispose();
        if(jComboBox1.getSelectedItem().toString().equals("Bono")){
            if(!conPrograma){
                DialogoPagoBonoSinProg dpb = new DialogoPagoBonoSinProg(null, true, cita);
                dpb.setLocationRelativeTo(null);
                dpb.setVisible(true);
            }
            else{
                DialogoPagoBonoConProg dpe = new DialogoPagoBonoConProg(null, true, cita, idPrograma);
                dpe.setLocationRelativeTo(null);
                dpe.setVisible(true);
            }
        }
        else if(jComboBox1.getSelectedItem().toString().equals("Efectivo")){
            if(!conPrograma){
                DialogoPagoEfectivoSinProg dpb = new DialogoPagoEfectivoSinProg(null, true, cita);
                dpb.setLocationRelativeTo(null);
                dpb.setVisible(true);
            }
            else{
                DialogoPagoEfectivoConProg dpe = new DialogoPagoEfectivoConProg(null, true, cita,idPrograma);
                dpe.setLocationRelativeTo(null);
                dpe.setVisible(true);
            }
            
        }
        else if(jComboBox1.getSelectedItem().toString().equals("Cheque")){
            if(!conPrograma){
                DialogoPagoChequeSinProg dpb = new DialogoPagoChequeSinProg(null, true, cita);
                dpb.setLocationRelativeTo(null);
                dpb.setVisible(true);
            }
            else{
                DialogoPagoChequeConProg dpc = new DialogoPagoChequeConProg(null, true, cita,idPrograma);
                dpc.setLocationRelativeTo(null);
                dpc.setVisible(true);
            }           
        }
    }//GEN-LAST:event_botonPagarActionPerformed

    private void botonCancelarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonCancelarActionPerformed
        this.dispose();
    }//GEN-LAST:event_botonCancelarActionPerformed
        
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton botonCancelar;
    private javax.swing.JButton botonPagar;
    private javax.swing.JComboBox jComboBox1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JPanel jPanel1;
    // End of variables declaration//GEN-END:variables

}
